<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2021/8/23
  Time: 17:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="climb" uri="/WEB-INF/tlds/climb.tld" %>
<form action="${pageContext.request.contextPath}/users/search" method="post">
    查询条件：
    <table width="100%" border=1>
        <tr>
            <td>姓名:<input type="text" name="user.name"></td>
            <td>电话号码:<input type="text" name="user.phoneNumber"></td>
            <td>最低薪水:<input type="text" name="salaryMin"></td>
            <td>最高薪水:<input type="text" name="salaryMax"></td>
        </tr>
        <tr>
            <td><input type="submit" value="查询"/></td>
        </tr>
    </table>
</form>
<form action="${pageContext.request.contextPath }/users/delete" method="post">
    <a href="${pathContext.request.contextPath}/users/add">新增</a>
    <input type="submit" value="删除"/><br/>
    商品列表：
    <table width="100%" border=1>
        <tr>
            <th><input type="checkbox" name="allid"/></th>
            <td>姓名</td>
            <td>体重</td>
            <td>电话号码</td>
            <td>邮箱</td>
            <td>生日</td>
            <td>薪水</td>
            <td>操作</td>
        </tr>
        <c:choose>
            <c:when test="${empty userList}">    <!--如果 -->
        <c:forEach items="${pageInfo.getList()}" var="item">
            <tr>
                <th><input type="checkbox" name="ids" value="${item.id}"/></th>
                <td>${item.name }</td>
                <td>${item.weight}</td>
                <td>${item.phoneNumber}</td>
                <td>${item.email}</td>
                <td>${climb:formatLocalDate(item.birthday, "yyyy-MM-dd")}</td>
                <td>${item.salary}</td>
                <td>
                    <img src="${pageContext.request.contextPath }/users/download?id=${item.id }" width="200" height="200"/>
                </td>
                <td>
                    <a href="${pageContext.request.contextPath}/users/findById?id=${item.id}">修改</a>
                    <a href="${pageContext.request.contextPath}/users/delete?ids=${item.id}">删除</a>
                </td>
            </tr>
        </c:forEach>
    </table>
        <div>
            页次：${pageInfo.pageNum}/${pageInfo.pages}&nbsp;每页${pageInfo.pageSize}&nbsp;总数${pageInfo.total}&nbsp;&nbsp;&nbsp;&nbsp;
            <a href="<c:url value='/users/page?pageNo=1'/>">首页</a>
            &nbsp;
            <c:choose>
                <c:when test="${!pageInfo.isFirstPage}">
                    <a href="<c:url value='/users/page?pageNo=${pageInfo.pageNum-1}'/>">上一页</a>
                </c:when>
            </c:choose>
            &nbsp;
            <c:choose>
                <c:when test="${!pageInfo.isLastPage}">
                    <a href="<c:url value='/users/page?pageNo=${pageInfo.pageNum+1}'/>">下一页</a>
                </c:when>
            </c:choose>
            <a href="<c:url value='/users/page?pageNo=${pageInfo.pages}'/>">尾页</a>
        </div>
    </c:when>
    <c:otherwise>  <!--否则 -->
        <c:forEach items="${userList}" var="item">
            <tr>
                <th><input type="checkbox" name="ids" value="${item.id}"/></th>
                <td>${item.name }</td>
                <td>${item.weight}</td>
                <td>${item.phoneNumber}</td>
                <td>${item.email}</td>
                <td>${climb:formatLocalDate(item.birthday, "yyyy-MM-dd")}</td>
                <td>${item.salary}</td>
                <td>
                    <a href="${pageContext.request.contextPath}/users/findById?id=${item.id}">修改</a>
                    <a href="${pageContext.request.contextPath}/users/delete?ids=${item.id}">删除</a>
                </td>
            </tr>
        </c:forEach>
        </table>
    </c:otherwise>
    </c:choose>
</form>
